#include <REGX52.H>
#include "Timer0.h"
#include "Delay.h"
#include "dulianjian.h"
#include <INTRINS.H>

unsigned Key,Den;
void main()
{
	P2=0xFE;
	Timer0Init();

	while(1)
	{
		Key=dulianjian();
		if(Key)
		{
			if(Key==1)
			{
				Den++;
				if(Den>=2)
				{Den=0;}
			}
		}
	}
}

void Timer0_Rountine(void) interrupt 1
{
	static unsigned int TimeCount=0;
	TL0 = 0x66;	
	TH0 = 0xFC;	
	TimeCount++;
	if(TimeCount>=500)
	{
		TimeCount=0;
		if(Den==0)
		{
			P2=_crol_(P2,1);
		}
		else if(Den==1)
		{
			P2=_cror_(P2,1);
		}
	}
}